<template>
  <div>
    <el-dialog v-model="dialogVisible" :title="$z.$t(title)" width="800px">
      <formz
        v-if="dialogVisible"
        ref="form"
        :data="data"
        :defaultdatavalue="defaultdatavalue"
        :inputs="inputs"
        label-position="left"
        label-width="100px"
        v-bind="$attrs"
      />
      <template #footer>
        <slot name="btnslot"></slot>
        <el-button @click="close">{{ $z.$t('取消') }}</el-button>
      </template>
    </el-dialog>
  </div>
</template>

<script>
  import formz from '../formz/index.vue'
  export default {
    name: 'Formdialog',
    components: {
      formz,
    },
    props: {},
    data() {
      return {
        dialogVisible: false,
        title: '',
        inputs: [],
        data: {},
        defaultdatavalue: {},
      }
    },
    created() {},
    mounted() {},
    methods: {
      close() {
        this.dialogVisible = false
      },
      show({ title = '', inputs = [], data = {} }) {
        this.dialogVisible = true
        this.title = title
        this.inputs = inputs
        this.data = data
      },
    },
  }
</script>
